#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
Author: Faker.Deng
Exercise after Chapter 1 Problem 3
"""


# Problem 3
def ball_jump_distance(height, count):
    """
    Calculate ball bouncing distance
    :param height: Starting height
    :param count: Bounce times
    :return: The total distance of a ball bouncing
    """
    count -= 1
    if count == 0:
        return height * 0.6 + height
    elif count > 0:
        return height * 0.6 + height + ball_jump_distance(0.6 * height, count)


if __name__ == "__main__":
    src_height = float(input("Please input source height: "))
    num_jump = int(input("Please input bounce times: "))
    print("Total jump distance is", ball_jump_distance(src_height, num_jump))
